home *** CD-ROM | disk | FTP | other *** search
- Path: afep.yorku.ca!ken
- From: ken@yorku.ca (Kenneth Kafieh)
- Newsgroups: comp.std.c
- Subject: Re: Faster FILE subroutines in standard C?
- Date: 4 Jan 1996 04:48:44 GMT
- Organization: York University
- Message-ID: <4cfm7c$dot@sunburst.ccs.yorku.ca>
- NNTP-Posting-Host: afep.yorku.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
-
-
- --
- I had to resort to drastic mesures inorder to put this message here.
- You are currently reading my signature file.
- Does anybody know why the @#$! that every time
- I try to post on this board, the only thing
- that gets posted is my @$%! sig file ?!?!
- while we're here I might as well post my message:
-
- I found that I was able to get 3-4 time faster performance by using good
- old ANSI C file accessing routines (like fgets, fseek, ftell, ...etc.)
- instead of C++ streams (like ifstream::getline, fstream::seekg, ...etc.)
- I wrote the program originally in C++ (a simple little phonebook for my
- own use) and it took about 9 seconds to scan a 100Kb file for a 3 byte
- string!!! Fed up, I rewrote it in C and voila! Now it takes 2 secs!
- I'm using Borland C++ v2.0.
-
- Does that sound right? Maybe my code was inefficiently written?
- I know C++ is generally slower than C but I didn't think that
- file stuff would be too. What did I do wrong? Am I missing
- something. Maybe I'll post the code too, later. Has anyone
- else noticed this too?
-
- Come to think of it, the coding in
- C was cleaner looking, too.
-
-
- And So Until Next Time...
-
- I'm Ken
-
-